/**
 * Generate code from /{{projectName}}-core/src/main/java/{{packageName}}/core/{{modules}}/domain/{{entities@MINHERIT}}.java.hbs
 */
package cn.ibizlab.core.authentication.domain;

import java.util.*;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.util.*;
import org.springframework.data.annotation.*;
import cn.ibizlab.util.annotation.*;
import cn.ibizlab.util.enums.*;
import cn.ibizlab.util.domain.IEntity;
import cn.ibizlab.util.domain.EntityBase;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.Accessors;
import io.swagger.annotations.*;

/**
 * 登录信息实体类[AuthLogin]
 *
 * @author generator
 */
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(value = "handler")
@ApiModel(value = "AUTH_LOGIN", description = "登录信息")
public class AuthLogin extends EntityBase implements Serializable
{

    /**
     * 标识
     */
    @Id
    @DEField(name = "id" , isKeyField = true)
    @JsonProperty("id")
    @JSONField(name = "id")
    @ApiModelProperty(value = "id", notes = "标识")
    private String id;

    /**
     * 登录名
     */
    @DEField(name = "login_name")
    @JsonProperty("login_name")
    @JSONField(name = "login_name")
    @ApiModelProperty(value = "login_name", notes = "登录名")
    private String loginName;

    /**
     * 密码
     */
    @DEField(name = "password")
    @JsonProperty("password")
    @JSONField(name = "password")
    @ApiModelProperty(value = "password", notes = "密码")
    private String password;

    /**
     * DC
     */
    @DEField(name = "dc")
    @JsonProperty("dc")
    @JSONField(name = "dc")
    @ApiModelProperty(value = "dc", notes = "DC")
    private String dc;

    /**
     * token类型
     */
    @DEField(name = "token_type")
    @JsonProperty("token_type")
    @JSONField(name = "token_type")
    @ApiModelProperty(value = "token_type", notes = "token类型")
    private String tokenType;

    /**
     * access_token
     */
    @DEField(name = "access_token")
    @JsonProperty("access_token")
    @JSONField(name = "access_token")
    @ApiModelProperty(value = "access_token", notes = "access_token")
    private String accessToken;

    /**
     * token
     */
    @DEField(name = "token")
    @JsonProperty("token")
    @JSONField(name = "token")
    @ApiModelProperty(value = "token", notes = "token")
    private String token;

    /**
     * 用户信息
     */
    @DEField(name = "user")
    @JsonProperty("user")
    @JSONField(name = "user")
    @ApiModelProperty(value = "user", notes = "用户信息")
    private AuthInfo user;

    /**
     * 范围
     */
    @DEField(name = "scope")
    @JsonProperty("scope")
    @JSONField(name = "scope")
    @ApiModelProperty(value = "scope", notes = "范围")
    private String scope;

    /**
     * token_id
     */
    @DEField(name = "token_id")
    @JsonProperty("token_id")
    @JSONField(name = "token_id")
    @ApiModelProperty(value = "token_id", notes = "token_id")
    private String tokenId;

    /**
     * 过期时间
     */
    @DEField(name = "expiration")
    @JsonProperty("expiration")
    @JSONField(name = "expiration")
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "expiration", notes = "过期时间")
    private Long expiration;

    /**
     * 过期剩余秒数
     */
    @DEField(name = "expires_in")
    @JsonProperty("expires_in")
    @JSONField(name = "expires_in")
    @ApiModelProperty(value = "expires_in", notes = "过期剩余秒数")
    private Integer expiresIn;

    /**
     * refresh_token
     */
    @DEField(name = "refresh_token")
    @JsonProperty("refresh_token")
    @JSONField(name = "refresh_token")
    @ApiModelProperty(value = "refresh_token", notes = "refresh_token")
    private String refreshToken;

    /**
     * 验证码标识
     */
    @DEField(name = "state")
    @JsonProperty("state")
    @JSONField(name = "state")
    @ApiModelProperty(value = "state", notes = "验证码标识")
    private String state;

    /**
     * 验证码
     */
    @DEField(name = "code")
    @JsonProperty("code")
    @JSONField(name = "code")
    @ApiModelProperty(value = "code", notes = "验证码")
    private String code;

    /**
     * 变更的新密码
     */
    @DEField(name = "new_password")
    @JsonProperty("new_password")
    @JSONField(name = "new_password")
    @ApiModelProperty(value = "new_password", notes = "变更的新密码")
    private String newPassword;

    /**
     * 手机号
     */
    @DEField(name = "phone")
    @JsonProperty("phone")
    @JSONField(name = "phone")
    @ApiModelProperty(value = "phone", notes = "手机号")
    private String phone;

    /**
     * 验证码图片
     */
    @DEField(name = "image")
    @JsonProperty("image")
    @JSONField(name = "image")
    @ApiModelProperty(value = "image", notes = "验证码图片")
    private String image;

    /**
     * 登录类型
     */
    @DEField(name = "login_type" , dict = "Auth_login_type")
    @JsonProperty("login_type")
    @JSONField(name = "login_type")
    @ApiModelProperty(value = "login_type", notes = "登录类型")
    private String loginType;

    /**
     * 名称
     */
    @DEField(name = "display_name")
    @JsonProperty("display_name")
    @JSONField(name = "display_name")
    @ApiModelProperty(value = "display_name", notes = "名称")
    private String displayName;


    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param includeEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T pasteTo(T targetEntity, boolean includeEmpty) {
        super.pasteTo(targetEntity, includeEmpty);
        if(targetEntity instanceof IEntity) {
            IEntity entity = ((IEntity) targetEntity);
            entity.reset("id");
        }
        return targetEntity;
    }

}